package com.fyakm.daodejing.test001core;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {
    public static void main(String[] args) throws IOException {
        Nature nature = new Nature();

        // 初始化环境输入数据（示例简单的字符串输入，可根据实际调整为更复杂的数据结构等）
        List<String> environmentInputData = Arrays.asList("input1", "input2", "input3");

        // 初始化物种1及其对应的输入输出数据
        List<String> inputDataList1 = Arrays.asList("input1", "input2", "input3");
        List<String> expectedOutputList1 = Arrays.asList("output1", "output2", "output3");
        Species species1 = new Species("Path/to/species1.java", inputDataList1, expectedOutputList1);
        nature.initializeSpecies(species1);

        // 初始化物种2及其对应的输入输出数据
        List<String> inputDataList2 = Arrays.asList("input1", "input2", "input3");
        List<String> expectedOutputList2 = Arrays.asList("output4", "output5", "output6");
        Species species2 = new Species("Path/to/species2.java", inputDataList2, expectedOutputList2);
        nature.initializeSpecies(species2);

        // 设置进化控制参数
        double crossoverRate = 0.8;
        double mutationRate = 0.05;
        EvolutionController evolutionController = new EvolutionController(crossoverRate, mutationRate);

        // 模拟多轮进化，这里示例模拟100轮
        for (int generation = 0; generation < 100; generation++) {
            nature.evolve(evolutionController, environmentInputData);
            // 可以在这里添加代码输出每一轮进化后物种的相关情况，便于观察进化结果
        }
    }
}